package br.com.upis.sispat.util;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

import br.com.upis.sispat.exception.SeamCoreException;

public class CryptoUtil {
	private CryptoUtil() {
	}
	public static String cryptography(String value) throws SeamCoreException {

		String crypto = "";

		MessageDigest m;
		try {

			m = MessageDigest.getInstance("MD5");
			m.update(value.getBytes(), 0, value.length());
			crypto = new String(m.digest());

		} catch (NoSuchAlgorithmException e) {
			throw new SeamCoreException(e.getMessage());
		}

		return crypto;
	}

}
